using System;
using System.Collections.Generic;
using System.Text;
using Colman.Rpg.Messaging;

namespace Colman.Rpg
{
    /// <summary>
    /// An interface detailing the contract required by both the object exposed by the server and its proxy on the client.
    /// </summary>
    public interface IServerProxy
    {
        /// <summary>
        /// Sends a message to the server.
        /// </summary>
        /// <param name="request">The request from the server.</param>
        void SendMessage(RequestMessage request);

        /// <summary>
        /// Logs a user into the server.
        /// </summary>
        /// <param name="clientEntry">The callback supplied by the client.</param>
        /// <param name="hashedPassword">The password to log the user in, in an MD5 hashed form.</param>
        void LoginUser(IClientCallback clientEntry, string hashedPassword);

        /// <summary>
        /// Logs a user out of the server.
        /// </summary>
        /// <param name="username">The user's name.</param>
        void LogOffUser(string username);
    }

    /// <summary>
    /// An interface detailing the contract required by both the callback exposed by the client and its proxy on the server.
    /// </summary>
    public interface IClientCallback
    {
        /// <summary>
        /// Gets the name of the user to whom this callback object belongs.
        /// </summary>
        string UserName { get; }
        /// <summary>
        /// Sends a message to the client.
        /// </summary>
        /// <param name="message"></param>
        void SendMessage(ResponseMessage message);
    }
}
